package cn.wen233.srpc.api.impl;

import cn.wen233.srpc.api.StudentService;
import cn.wen233.srpc.core.service.SunglowService;
import cn.wen233.srpc.model.Book;
import cn.wen233.srpc.model.Student;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @author wenei
 * @date 2021-10-27 22:12
 */
@SunglowService(interfaceClass = StudentService.class)
public class StudentServiceImpl implements StudentService {
    @Override
    public Student update(Student student) {
        Student student1 = new Student();
        student1.setName("1999999");
        student1.setAge(18);
        List<Book> books = new ArrayList<>(student.getBooks());
        Book book = new Book();
        book.setPrice(BigDecimal.valueOf(69));
        book.setName("服务端添加的");
        books.add(book);
        student1.setBooks(books);
        return student1;
    }
}
